package com.cxg.fairy.ec.main;

import android.annotation.SuppressLint;
import android.graphics.Color;

import com.cxg.fairy.delegates.bottom.BaseBottomDelegate;
import com.cxg.fairy.delegates.bottom.BottomItemDelegate;
import com.cxg.fairy.delegates.bottom.BottomTabBean;
import com.cxg.fairy.delegates.bottom.ItemBuilder;
import com.cxg.fairy.ec.main.cart.ShopCartDelegate;
import com.cxg.fairy.ec.main.discover.DiscoverDelegate;
import com.cxg.fairy.ec.main.index.IndexDelegate;
import com.cxg.fairy.ec.main.personal.PersonalDelegate;
import com.cxg.fairy.ec.main.sort.SortDelegate;

import java.util.LinkedHashMap;

/**
 * Created by CFairy
 */

@SuppressLint({"NewApi", "ValidFragment"})
public class EcBottomDelegate extends BaseBottomDelegate {

    private int index_position = 0;

    public EcBottomDelegate() {
    }

    public EcBottomDelegate(int index_position) {
        super(index_position);
        this.index_position = index_position;
    }

    @Override
    public LinkedHashMap<BottomTabBean, BottomItemDelegate> setItems(ItemBuilder builder) {
        final LinkedHashMap<BottomTabBean, BottomItemDelegate> items = new LinkedHashMap<>();
        items.put(new BottomTabBean("{icon-index-home}", "主页"), new IndexDelegate());
        items.put(new BottomTabBean("{icon-index-types 90%}", "分类"), new SortDelegate());
        items.put(new BottomTabBean("{icon-index-discover spin}", "发现"), new DiscoverDelegate());
        items.put(new BottomTabBean("{icon-index-shopcart}", "购物车"), new ShopCartDelegate());
        items.put(new BottomTabBean("{icon-index-mine}", "我的"), new PersonalDelegate());
        return builder.addItems(items).build();
    }

    @Override
    public int setIndexDelegate() {
        return index_position;
    }

    @Override
    public int setClickedColor() {
        return Color.parseColor("#ffff8800");
    }
}
